<template>
  <div>
    <h2 style="text-align: center;">用户账号显示列表</h2>
    <table class="table table-bordered">
      <thead>
        <tr>
          <td>账号编号</td>
          <td>账号</td>
          <td>密码</td>
          <td>注册时间</td>
        </tr>
      </thead>
      <tbody v-for="em in info" :key="em.uid">
        <tr>
          <td>{{ em.uid }}</td>
          <td>{{ em.uname }}</td>
          <td>{{ em.upwd }}***</td>
          <td>{{ em.udate.substring(0,10) }}</td>
        </tr>

      </tbody>
    </table>
    

  </div>
</template>

<script setup lang="ts">
import { ref,onMounted } from 'vue';
import axios from 'axios';
import {useRouter} from 'vue-router';
let router=useRouter();
const info=ref([{
  uid:0,
  uname:"",
  upwd:"",
  udate:"",
}])
//生命周期
onMounted(()=>{
  xian();
})
//显示账号信息列表
const xian=()=>{
  axios({
    url:"http://localhost:8322/api/User/usershow",
    method:"get",

  }).then((res)=>{
    info.value=res.data;
    console.log(res.data);
  }).catch((err)=>{
    console.log(err);
  })
}

</script>

<style scoped>

</style>